local skynet = require "skynet"
local tabletool = require "tabletool"
local msghelper = require "tablehelper"
local filelog = require "filelog"
local timer = require "timer"
local timetool = require "timetool"
require "dzpkenum"

local RoomSeatLogic = {}

function RoomSeatLogic.init(seatobj, index)
	seatobj.index = index
	seatobj.state = ESeatState.SEAT_STATE_NO_PLAYER
	seatobj.is_tuoguan = EBOOL.FALSE
	return true
end

function RoomSeatLogic.clear(seatobj)
	seatobj.rid = 0
	seatobj.state = 0  --改坐位玩家状态
	seatobj.playerinfo = {}
end

function RoomSeatLogic.is_empty(seatobj)
	return (seatobj.state == ESeatState.SEAT_STATE_NO_PLAYER)
end

function RoomSeatLogic.clear_seat(seat)
	seat.rid = 0
	seat.state = ESeatState.SEAT_STATE_NO_PLAYER
	seat.playerinfo = {}
	seat.is_tuoguan = EBOOL.FALSE
	seat.timeout_count = 0
	seat.diamond = 0
	seat.startdiamond = 0
	seat.fangka = 0
	seat.is_ready = EBOOL.FALSE
	seat.ready_to_time = 0
	seat.cards = {}
	seat.card_form = 0   	 --牌型
	seat.form_cards = {} 	 --牌型对应的牌
	seat.is_disconnect = nil
	seat.standup = nil
	seat.sametabledata = nil
	seat.bets = 0
	seat.curr_bets = 0
	if seat.ready_timer_id and seat.ready_timer_id > 0 then
		timer.cleartimer(seat.ready_timer_id)
		seat.ready_timer_id = -1
	end
end

function RoomSeatLogic.onegamestart_initseat(seat)
	seat.state = ESeatState.SEAT_STATE_PLAYING
	seat.startdiamond = seat.diamond
	seat.cards = {}
	seat.bets = 0
	seat.curr_bets = 0
	seat.card_form = 0   	 --牌型
	seat.form_cards = {} 	 --牌型对应的牌
	seat.ready_to_time = 0
	if seat.ready_timer_id and seat.ready_timer_id > 0 then
		timer.cleartimer(seat.ready_timer_id)
		seat.ready_timer_id = -1
	end
end

return RoomSeatLogic